package com.zhilianbao.leyaogo.ui.activity.me.setting;

import android.os.Bundle;
import android.view.View;
import android.widget.RelativeLayout;

import com.bql.utils.EventManager;
import com.zhilianbao.leyaogo.R;
import com.zhilianbao.leyaogo.events.LeEventCode;
import com.zhilianbao.leyaogo.ui.activity.base.BaseOkHttpActivity;
import com.zhilianbao.leyaogo.utils.Utils;


import org.greenrobot.eventbus.EventBus;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 账户与安全
 */
public class AccountSafeActivity extends BaseOkHttpActivity {

    @BindView(R.id.phone_num_into)
    RelativeLayout mPhoneNumInto;
    @BindView(R.id.phone_pwd_into)
    RelativeLayout mPhonePwdInto;
    @BindView(R.id.chang_login_pwd)
    RelativeLayout mChangLoginPwd;
    @Override
    protected int getContentViewLayoutID() {
        return R.layout.activity_account_safe;
    }

    @Override
    protected void initViewsAndEvents(Bundle savedInstanceState) {
        initToolbar(getString(R.string.account_safe));
    }

    @OnClick({R.id.phone_num_into, R.id.phone_pwd_into,R.id.chang_login_pwd})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.phone_num_into:
                Utils.startActivity(this,ChangePhoneNumActivity.class);
                break;
            case R.id.phone_pwd_into:
                Utils.startActivity(this,SetPwdActivity.class);
                break;
            case R.id.chang_login_pwd :
                Utils.startActivity(this,ChangLoginPwdOriActivity.class);
                break;
        }
    }

    @Override
    protected void onHandleEvent(EventManager eventManager) {
        super.onHandleEvent(eventManager);
        switch (eventManager.getEventCode()) {
            case LeEventCode.MSG_CODE_CLICK_NOT_LOGIN_BACK://点击了登录的返回键
                //发消息回到我的页面
                EventBus.getDefault().post(new EventManager(LeEventCode.MSG_CODE_SWICH_TO_ME));
                finish();
                break;
        }
    }
}
